﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using System.IO;
using System.Text;

using System.Security;
using System.Security.Permissions;

using System.Runtime.InteropServices;

using ConvertDotNetLIBHelper;

namespace proto_convertdotnet_client
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Canvas_Drop(object sender, DragEventArgs e)
        {

            FileInfo[] files = (FileInfo[]) e.Data.GetData(System.Windows.DataFormats.FileDrop); 
            
            String content = String.Empty;

            foreach (FileInfo file in files)
                content += ParseFile(file.FullName);

            MessageBox.Show(content);
        }

        [SecurityCritical, SecuritySafeCriticalAttribute]
        private String ParseFile(string filenameAndPath)
        {
            StringBuilder content = new StringBuilder();

            content.Append(filenameAndPath + " = " + Helper.GetFileType(filenameAndPath).ToString());

            return content.ToString();
        }
    }
}
